<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:html="http://www.w3.org/1999/xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:f="livcos.org/ns/xslt/function"
  xmlns:v="livcos.org/ns/view"
  exclude-result-prefixes="html xs f v">
	
	<xsl:import href="base.xsl"/>
	
	<xsl:param name="incl-chapter_numbering" select="'1'"/>
	
	<xsl:template match="@* | node()">
		<xsl:copy copy-namespaces="no">
			<xsl:apply-templates select="@* | node()"/>
		</xsl:copy>
	</xsl:template>
	
	<xsl:template match="v:*">
	</xsl:template>
	
	<xsl:template match="v:head/v:context">
		<p class="context">
			<xsl:apply-templates select="." mode="inlineEdit"/>
		</p>
	</xsl:template>
	
	<xsl:template match="v:head/v:title">
		<p class="title">
			<xsl:apply-templates select="." mode="inlineEdit"/>
		</p>
	</xsl:template>
	
	<xsl:template match="v:chapter">
		<div>
			<xsl:apply-templates select="@*"/>
			<xsl:element name="h{count(ancestor::v:chapter) + 1}">
				<xsl:if test="$incl-chapter_numbering = '1'">
					<xsl:number level="multiple" count="v:chapter" format="1.1"/>
					<xsl:text>&#160;</xsl:text>
				</xsl:if>
				<xsl:apply-templates select="v:title" mode="inlineEdit"/>
			</xsl:element>
			<xsl:apply-templates select="node()"/>
		</div>
	</xsl:template>
	
	<xsl:template match="v:*" mode="inlineEdit">
		<xsl:apply-templates select="node()"/>
	</xsl:template>
	
	<xsl:template match="v:*[@path]" priority="2" mode="inlineEdit">
		<span class="inlineEdit">
			<span class="inlnEd_path" title="{@path}"/>
			<xsl:apply-templates select="node()"/>
		</span>
	</xsl:template>
	
</xsl:stylesheet>
